package itheima.com.Utiley;

import org.junit.Test;

import java.io.File;
import java.io.IOException;

public class newFile {


    public static void main(String[] args) {



    }

    @Test
    public void  createFile(){
        String fliePath = "D:\\一条小团团\\xiao.txt";
        File file = new File(fliePath);

        try {

            file.createNewFile();
            System.out.println("文件创建成功。。。。。");
        } catch (IOException e) {
//            throw new RuntimeException(e);
            e.printStackTrace();
            System.out.println("文件创建失败");
        }
    }
    @Test
    public void createFile02(){
        File file = new File("D:\\一条小团团");
        String filePath = "xiao.txt";
        File file1 = new File(file, filePath);
        try {
            file1.createNewFile();
            System.out.println("文件创建成功");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }



}
